home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 July: Mac OS SDK / Dev.CD Jul 96 SDK / Dev.CD Jul 96 SDK1.toast / Development Kits (Disc 1) / Interfaces & Libraries / Interfaces / AIncludes / SoundInput.a < prev    next >
Encoding:
Text File  |  1996-01-24  |  10.6 KB  |  436 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        SoundInput.a
  3. ;
  4. ;    Contains:    Sound Input Interfaces.
  5. ;
  6. ;    Version:    Technology:    System 7.5
  7. ;                Package:    Universal Interfaces 2.2 in “MPW” on ETO #20
  8. ;
  9. ;    Copyright:    © 1984-1995 by Apple Computer, Inc.
  10. ;                All rights reserved.
  11. ;
  12. ;    Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13. ;                stack.  Include the file and version information (from above)
  14. ;                in the problem description and send to:
  15. ;                    Internet:    apple.bugs@applelink.apple.com
  16. ;                    AppleLink:    APPLE.BUGS
  17. ;
  18. ;
  19.  
  20.     IF &TYPE('__SOUNDINPUT__') = 'UNDEFINED' THEN
  21. __SOUNDINPUT__ SET 1
  22.  
  23.  
  24.     IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
  25.     include 'Types.a'
  26.     ENDIF
  27. ;        include 'ConditionalMacros.a'                                ;
  28.  
  29.     IF &TYPE('__APPLEEVENTS__') = 'UNDEFINED' THEN
  30.     include 'AppleEvents.a'
  31.     ENDIF
  32. ;        include 'Errors.a'                                            ;
  33. ;        include 'Memory.a'                                            ;
  34. ;            include 'MixedMode.a'                                    ;
  35. ;        include 'OSUtils.a'                                        ;
  36. ;        include 'Events.a'                                            ;
  37. ;            include 'Quickdraw.a'                                    ;
  38. ;                include 'QuickdrawText.a'                            ;
  39. ;        include 'EPPC.a'                                            ;
  40. ;            include 'AppleTalk.a'                                    ;
  41. ;            include 'Files.a'                                        ;
  42. ;                include 'Finder.a'                                    ;
  43. ;            include 'PPCToolbox.a'                                    ;
  44. ;            include 'Processes.a'                                    ;
  45. ;        include 'Notification.a'                                    ;
  46.  
  47.     IF &TYPE('__WINDOWS__') = 'UNDEFINED' THEN
  48.     include 'Windows.a'
  49.     ENDIF
  50. ;        include 'Controls.a'                                        ;
  51. ;            include 'Menus.a'                                        ;
  52.  
  53.     IF &TYPE('__DIALOGS__') = 'UNDEFINED' THEN
  54.     include 'Dialogs.a'
  55.     ENDIF
  56. ;        include 'TextEdit.a'                                        ;
  57.  
  58.     IF &TYPE('__FILES__') = 'UNDEFINED' THEN
  59.     include 'Files.a'
  60.     ENDIF
  61.  
  62.     IF &TYPE('__SOUND__') = 'UNDEFINED' THEN
  63.     include 'Sound.a'
  64.     ENDIF
  65. ;        include 'Components.a'                                        ;
  66.  
  67. siDeviceIsConnected                EQU        1                    ;input device is connected and ready for input
  68. siDeviceNotConnected            EQU        0                    ;input device is not connected
  69. siDontKnowIfConnected            EQU        -1                    ;can't tell if input device is connected
  70. siReadPermission                EQU        0                    ;permission passed to SPBOpenDevice
  71. siWritePermission                EQU        1                    ;permission passed to SPBOpenDevice
  72.  
  73. ;Info Selectors for Sound Input Drivers
  74. siActiveChannels                EQU        'chac'                ;active channels
  75. siActiveLevels                    EQU        'lmac'                ;active meter levels
  76. siAGCOnOff                        EQU        'agc '                ;automatic gain control state
  77. siAsync                            EQU        'asyn'                ;asynchronous capability
  78. siChannelAvailable                EQU        'chav'                ;number of channels available
  79. siCompressionAvailable            EQU        'cmav'                ;compression types available
  80. siCompressionFactor                EQU        'cmfa'                ;current compression factor
  81. siCompressionHeader                EQU        'cmhd'                ;return compression header
  82. siCompressionNames                EQU        'cnam'                ;compression type names available
  83. siCompressionType                EQU        'comp'                ;current compression type
  84. siContinuous                    EQU        'cont'                ;continous recording
  85. siDeviceBufferInfo                EQU        'dbin'                ;size of interrupt buffer
  86. siDeviceConnected                EQU        'dcon'                ;input device connection status
  87. siDeviceIcon                    EQU        'icon'                ;input device icon
  88. siDeviceName                    EQU        'name'                ;input device name
  89. siHardwareBusy                    EQU        'hwbs'                ;sound hardware is in use
  90. siInputGain                        EQU        'gain'                ;input gain
  91. siInputSource                    EQU        'sour'                ;input source selector
  92. siInputSourceNames                EQU        'snam'                ;input source names
  93. siLevelMeterOnOff                EQU        'lmet'                ;level meter state
  94. siModemGain                        EQU        'mgai'                ;modem input gain
  95. siNumberChannels                EQU        'chan'                ;current number of channels
  96. siOptionsDialog                    EQU        'optd'                ;display options dialog
  97. siPlayThruOnOff                    EQU        'plth'                ;playthrough state
  98. siRecordingQuality                EQU        'qual'                ;recording quality
  99. siSampleRate                    EQU        'srat'                ;current sample rate
  100. siSampleRateAvailable            EQU        'srav'                ;sample rates available
  101. siSampleSize                    EQU        'ssiz'                ;current sample size
  102. siSampleSizeAvailable            EQU        'ssav'                ;sample sizes available
  103. siSetupCDAudio                    EQU        'sucd'                ;setup sound hardware for CD audio
  104. siSetupModemAudio                EQU        'sumd'                ;setup sound hardware for modem audio
  105. siStereoInputGain                EQU        'sgai'                ;stereo input gain
  106. siTwosComplementOnOff            EQU        'twos'                ;two's complement state
  107. siVoxRecordInfo                    EQU        'voxr'                ;VOX record parameters
  108. siVoxStopInfo                    EQU        'voxs'                ;VOX stop parameters
  109. siCloseDriver                    EQU        'clos'                ;reserved for internal use only
  110. siInitializeDriver                EQU        'init'                ;reserved for internal use only
  111. siPauseRecording                EQU        'paus'                ;reserved for internal use only
  112. siUserInterruptProc                EQU        'user'                ;reserved for internal use only
  113. ;Qualities
  114. siCDQuality                        EQU        'cd  '                ;44.1kHz, stereo, 16 bit
  115. siBestQuality                    EQU        'best'                ;22kHz, mono, 8 bit
  116. siBetterQuality                    EQU        'betr'                ;22kHz, mono, MACE 3:1
  117. siGoodQuality                    EQU        'good'
  118.  
  119. ; typedef struct SPB         SPB, *SPBPtr
  120. ;user procedures called by sound input routines
  121. SPB                     RECORD    0
  122. inRefNum                 ds.l   1        ; offset: $0 (0)        ;reference number of sound input device
  123. count                     ds.l   1        ; offset: $4 (4)        ;number of bytes to record
  124. milliseconds             ds.l   1        ; offset: $8 (8)        ;number of milliseconds to record
  125. bufferLength             ds.l   1        ; offset: $C (12)        ;length of buffer in bytes
  126. bufferPtr                 ds.l   1        ; offset: $10 (16)        ;buffer to store sound data in
  127. completionRoutine         ds.l   1        ; offset: $14 (20)        ;completion routine
  128. interruptRoutine         ds.l   1        ; offset: $18 (24)        ;interrupt routine
  129. userLong                 ds.l   1        ; offset: $1C (28)        ;user-defined field
  130. error                     ds.w   1        ; offset: $20 (32)        ;error
  131. unused1                     ds.l   1        ; offset: $22 (34)        ;reserved - must be zero
  132. sizeof                     EQU *            ; size:   $26 (38)
  133.                         ENDR
  134.  
  135. ;
  136. ; pascal NumVersion SPBVersion(void)
  137. ;
  138.     IF ¬ GENERATINGCFM THEN
  139.         Macro
  140.         _SPBVersion
  141.             dc.w     $203C
  142.             dc.w     $0000
  143.             dc.w     $0014
  144.             dc.w     $A800
  145.         EndM
  146.     ELSE
  147.         IMPORT_CFM_FUNCTION    SPBVersion
  148.     ENDIF
  149.  
  150. ;
  151. ; pascal OSErr SndRecord(ModalFilterUPP filterProc, Point corner, OSType quality, SndListHandle *sndHandle)
  152. ;
  153.     IF ¬ GENERATINGCFM THEN
  154.         Macro
  155.         _SndRecord
  156.             dc.w     $203C
  157.             dc.w     $0804
  158.             dc.w     $0014
  159.             dc.w     $A800
  160.         EndM
  161.     ELSE
  162.         IMPORT_CFM_FUNCTION    SndRecord
  163.     ENDIF
  164.  
  165. ;
  166. ; pascal OSErr SndRecordToFile(ModalFilterUPP filterProc, Point corner, OSType quality, short fRefNum)
  167. ;
  168.     IF ¬ GENERATINGCFM THEN
  169.         Macro
  170.         _SndRecordToFile
  171.             dc.w     $203C
  172.             dc.w     $0708
  173.             dc.w     $0014
  174.             dc.w     $A800
  175.         EndM
  176.     ELSE
  177.         IMPORT_CFM_FUNCTION    SndRecordToFile
  178.     ENDIF
  179.  
  180. ;
  181. ; pascal OSErr SPBSignInDevice(short deviceRefNum, ConstStr255Param deviceName)
  182. ;
  183.     IF ¬ GENERATINGCFM THEN
  184.         Macro
  185.         _SPBSignInDevice
  186.             dc.w     $203C
  187.             dc.w     $030C
  188.             dc.w     $0014
  189.             dc.w     $A800
  190.         EndM
  191.     ELSE
  192.         IMPORT_CFM_FUNCTION    SPBSignInDevice
  193.     ENDIF
  194.  
  195. ;
  196. ; pascal OSErr SPBSignOutDevice(short deviceRefNum)
  197. ;
  198.     IF ¬ GENERATINGCFM THEN
  199.         Macro
  200.         _SPBSignOutDevice
  201.             dc.w     $203C
  202.             dc.w     $0110
  203.             dc.w     $0014
  204.             dc.w     $A800
  205.         EndM
  206.     ELSE
  207.         IMPORT_CFM_FUNCTION    SPBSignOutDevice
  208.     ENDIF
  209.  
  210. ;
  211. ; pascal OSErr SPBGetIndexedDevice(short count, Str255 deviceName, Handle *deviceIconHandle)
  212. ;
  213.     IF ¬ GENERATINGCFM THEN
  214.         Macro
  215.         _SPBGetIndexedDevice
  216.             dc.w     $203C
  217.             dc.w     $0514
  218.             dc.w     $0014
  219.             dc.w     $A800
  220.         EndM
  221.     ELSE
  222.         IMPORT_CFM_FUNCTION    SPBGetIndexedDevice
  223.     ENDIF
  224.  
  225. ;
  226. ; pascal OSErr SPBOpenDevice(ConstStr255Param deviceName, short permission, long *inRefNum)
  227. ;
  228.     IF ¬ GENERATINGCFM THEN
  229.         Macro
  230.         _SPBOpenDevice
  231.             dc.w     $203C
  232.             dc.w     $0518
  233.             dc.w     $0014
  234.             dc.w     $A800
  235.         EndM
  236.     ELSE
  237.         IMPORT_CFM_FUNCTION    SPBOpenDevice
  238.     ENDIF
  239.  
  240. ;
  241. ; pascal OSErr SPBCloseDevice(long inRefNum)
  242. ;
  243.     IF ¬ GENERATINGCFM THEN
  244.         Macro
  245.         _SPBCloseDevice
  246.             dc.w     $203C
  247.             dc.w     $021C
  248.             dc.w     $0014
  249.             dc.w     $A800
  250.         EndM
  251.     ELSE
  252.         IMPORT_CFM_FUNCTION    SPBCloseDevice
  253.     ENDIF
  254.  
  255. ;
  256. ; pascal OSErr SPBRecord(SPBPtr inParamPtr, Boolean asynchFlag)
  257. ;
  258.     IF ¬ GENERATINGCFM THEN
  259.         Macro
  260.         _SPBRecord
  261.             dc.w     $203C
  262.             dc.w     $0320
  263.             dc.w     $0014
  264.             dc.w     $A800
  265.         EndM
  266.     ELSE
  267.         IMPORT_CFM_FUNCTION    SPBRecord
  268.     ENDIF
  269.  
  270. ;
  271. ; pascal OSErr SPBRecordToFile(short fRefNum, SPBPtr inParamPtr, Boolean asynchFlag)
  272. ;
  273.     IF ¬ GENERATINGCFM THEN
  274.         Macro
  275.         _SPBRecordToFile
  276.             dc.w     $203C
  277.             dc.w     $0424
  278.             dc.w     $0014
  279.             dc.w     $A800
  280.         EndM
  281.     ELSE
  282.         IMPORT_CFM_FUNCTION    SPBRecordToFile
  283.     ENDIF
  284.  
  285. ;
  286. ; pascal OSErr SPBPauseRecording(long inRefNum)
  287. ;
  288.     IF ¬ GENERATINGCFM THEN
  289.         Macro
  290.         _SPBPauseRecording
  291.             dc.w     $203C
  292.             dc.w     $0228
  293.             dc.w     $0014
  294.             dc.w     $A800
  295.         EndM
  296.     ELSE
  297.         IMPORT_CFM_FUNCTION    SPBPauseRecording
  298.     ENDIF
  299.  
  300. ;
  301. ; pascal OSErr SPBResumeRecording(long inRefNum)
  302. ;
  303.     IF ¬ GENERATINGCFM THEN
  304.         Macro
  305.         _SPBResumeRecording
  306.             dc.w     $203C
  307.             dc.w     $022C
  308.             dc.w     $0014
  309.             dc.w     $A800
  310.         EndM
  311.     ELSE
  312.         IMPORT_CFM_FUNCTION    SPBResumeRecording
  313.     ENDIF
  314.  
  315. ;
  316. ; pascal OSErr SPBStopRecording(long inRefNum)
  317. ;
  318.     IF ¬ GENERATINGCFM THEN
  319.         Macro
  320.         _SPBStopRecording
  321.             dc.w     $203C
  322.             dc.w     $0230
  323.             dc.w     $0014
  324.             dc.w     $A800
  325.         EndM
  326.     ELSE
  327.         IMPORT_CFM_FUNCTION    SPBStopRecording
  328.     ENDIF
  329.  
  330. ;
  331. ; pascal OSErr SPBGetRecordingStatus(long inRefNum, short *recordingStatus, short *meterLevel, unsigned long *totalSamplesToRecord, unsigned long *numberOfSamplesRecorded, unsigned long *totalMsecsToRecord, unsigned long *numberOfMsecsRecorded)
  332. ;
  333.     IF ¬ GENERATINGCFM THEN
  334.         Macro
  335.         _SPBGetRecordingStatus
  336.             dc.w     $203C
  337.             dc.w     $0E34
  338.             dc.w     $0014
  339.             dc.w     $A800
  340.         EndM
  341.     ELSE
  342.         IMPORT_CFM_FUNCTION    SPBGetRecordingStatus
  343.     ENDIF
  344.  
  345. ;
  346. ; pascal OSErr SPBGetDeviceInfo(long inRefNum, OSType infoType, void *infoData)
  347. ;
  348.     IF ¬ GENERATINGCFM THEN
  349.         Macro
  350.         _SPBGetDeviceInfo
  351.             dc.w     $203C
  352.             dc.w     $0638
  353.             dc.w     $0014
  354.             dc.w     $A800
  355.         EndM
  356.     ELSE
  357.         IMPORT_CFM_FUNCTION    SPBGetDeviceInfo
  358.     ENDIF
  359.  
  360. ;
  361. ; pascal OSErr SPBSetDeviceInfo(long inRefNum, OSType infoType, void *infoData)
  362. ;
  363.     IF ¬ GENERATINGCFM THEN
  364.         Macro
  365.         _SPBSetDeviceInfo
  366.             dc.w     $203C
  367.             dc.w     $063C
  368.             dc.w     $0014
  369.             dc.w     $A800
  370.         EndM
  371.     ELSE
  372.         IMPORT_CFM_FUNCTION    SPBSetDeviceInfo
  373.     ENDIF
  374.  
  375. ;
  376. ; pascal OSErr SPBMillisecondsToBytes(long inRefNum, long *milliseconds)
  377. ;
  378.     IF ¬ GENERATINGCFM THEN
  379.         Macro
  380.         _SPBMillisecondsToBytes
  381.             dc.w     $203C
  382.             dc.w     $0440
  383.             dc.w     $0014
  384.             dc.w     $A800
  385.         EndM
  386.     ELSE
  387.         IMPORT_CFM_FUNCTION    SPBMillisecondsToBytes
  388.     ENDIF
  389.  
  390. ;
  391. ; pascal OSErr SPBBytesToMilliseconds(long inRefNum, long *byteCount)
  392. ;
  393.     IF ¬ GENERATINGCFM THEN
  394.         Macro
  395.         _SPBBytesToMilliseconds
  396.             dc.w     $203C
  397.             dc.w     $0444
  398.             dc.w     $0014
  399.             dc.w     $A800
  400.         EndM
  401.     ELSE
  402.         IMPORT_CFM_FUNCTION    SPBBytesToMilliseconds
  403.     ENDIF
  404.  
  405. ;
  406. ; pascal OSErr SetupSndHeader(SndListHandle sndHandle, short numChannels, UnsignedFixed sampleRate, short sampleSize, OSType compressionType, short baseNote, unsigned long numBytes, short *headerLen)
  407. ;
  408.     IF ¬ GENERATINGCFM THEN
  409.         Macro
  410.         _SetupSndHeader
  411.             dc.w     $203C
  412.             dc.w     $0D48
  413.             dc.w     $0014
  414.             dc.w     $A800
  415.         EndM
  416.     ELSE
  417.         IMPORT_CFM_FUNCTION    SetupSndHeader
  418.     ENDIF
  419.  
  420. ;
  421. ; pascal OSErr SetupAIFFHeader(short fRefNum, short numChannels, UnsignedFixed sampleRate, short sampleSize, OSType compressionType, unsigned long numBytes, unsigned long numFrames)
  422. ;
  423.     IF ¬ GENERATINGCFM THEN
  424.         Macro
  425.         _SetupAIFFHeader
  426.             dc.w     $203C
  427.             dc.w     $0B4C
  428.             dc.w     $0014
  429.             dc.w     $A800
  430.         EndM
  431.     ELSE
  432.         IMPORT_CFM_FUNCTION    SetupAIFFHeader
  433.     ENDIF
  434.  
  435.     ENDIF ; __SOUNDINPUT__
  436.